import {
  Table,
} from 'choerodon-ui/pro';
import React, { useContext, ReactElement, MouseEventHandler } from 'react';
import {
  TableEditMode,
  TableButtonType,
} from 'choerodon-ui/pro/lib/table/enum';
import { ButtonProps } from 'choerodon-ui/pro/lib/button/Button';
import { ColumnProps } from 'choerodon-ui/pro/lib/table/Column';
import Store from './stores';

export declare type TableButtonProps = ButtonProps & {
  afterClick?: MouseEventHandler<any>;
};
export declare type Buttons = TableButtonType | [TableButtonType, TableButtonProps] | ReactElement<TableButtonProps>;
const From: React.FC = (): React.ReactElement => {

  const { tableInlineDataSet } = useContext(Store);


  const columns: ColumnProps[] = [
    { name: 'id', style: { color: '#3399CC' }, width: 150, lock: true }, // 自定义列的样式
    { name: 'name', width: 150, sortable: true },
    { name: 'barcode', width: 150, sortable: true },
    { name: 'price', width: 150, sortable: true },
    { name: 'num', width: 150, sortable: true },
    { name: 'amount', width: 150, sortable: true },
  ];

  return (
    <Table
      header="退货商品"
      dataSet={tableInlineDataSet!}
      columns={columns}
      editMode={TableEditMode.inline}
      pagination={false}
    />
  );
};

export default From;